<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>森唛</title>
        {=include file="blocks/meta.html"=}
        <script src="{=$root=}/static/js/jquery-1.6.4.min.js" type="text/javascript"></script>
        <style type="text/css">
            ul#bimg{position:absolute; width:4800px;}
            ul#bimg li{ float:left; margin:0; padding:0;}
            ul#recommend_b{position:absolute; width:{=$rc=}px;}
            ul#recommend_b li{ float:left; margin:0; padding:0;}
        </style>
    </head>

    <body>
        <div class="wrap">
            <div class="container">
                <!--header-->
                {=include file="blocks/header.html"=}
                <!--banner-->
                <div class="g_banner">
                    <div class="banner">
                        <div class="show" style="position:relative;">
                            <ul id="bimg" style="left:0;">
                                {=foreach from=$data.cycle item=item=}
                                <li>
                                    <a href="{=$item.link=}" title=""><img src="{=$root=}/uploads/{=$item.img=}" alt="" /></a>
                                </li>
                                {=/foreach=}
                            </ul>
                        </div>
                        <div class="focus">
                            <ul class="cf" id="simg">
                                {=foreach from=$data.cycle key=key item=item=}
                                <li{=if $key==0=} class="active"{=/if=}>
                                    <a href="#" title=""><img src="{=$root=}/uploads/{=$item.thumb=}" alt="" /></a>
                                </li>
                                {=/foreach=}
                            </ul>
                        </div>
                    </div>
                </div>
                <!--search-->
                <div class="g_search cf">
                    <div class="hot_products fl">
                        <i></i>
                        <span>产品分类及热门产品：</span>
                        <a href="#" title="软包家具">软包家具</a>
                        <a href="#" title="软包床">软包床</a>
                        <a href="#" title="家具饰品">家具饰品</a>
                        <a href="#" title="懒人沙发">懒人沙发</a>
                    </div>
                    <div class="search fr">
                        <form name="searchForm" method="get" action="{=$base=}" onsubmit="if(this.kw.value==''){alert('请输入关键词');return false;}">
                            <input type="hidden" name="c" value="product" />
                            <input type="text" name="kw" class="txt" />
                            <input type="submit" value="搜索" class="submit" />
                        </form>
                    </div>
                </div>
                <!--home main-->
                <div class="g_home">
                    <div class="home_main cf">
                        <div class="homeMessage">
                            <div class="hd">
                                <h3>在线留言</h3>
                            </div>
                            <div class="bd">
                                <form name="msgForm" id="msgForm" method="post" action="{=$base=}/?c=message&a=save" onsubmit="return checkMsgform(this)">
                                    <dl class="cf">
                                        <dt><em>*</em>内容：</dt>
                                        <dd>
                                            <textarea class="textArea" name="content" id="content"></textarea>
                                        </dd>
                                    </dl>
                                    <dl class="cf">
                                        <dt><em>*</em>姓名：</dt>
                                        <dd>
                                            <input type="text" class="txt" name="name" id="name" />
                                        </dd>
                                    </dl>
                                    <dl class="cf">
                                        <dt><em>*</em>电话：</dt>
                                        <dd>
                                            <input type="text" class="txt" name="phone" id="phone" />
                                        </dd>
                                    </dl>
                                    <dl class="cf">
                                        <dt>地址：</dt>
                                        <dd>
                                            <input type="text" class="txt" name="address" id="address" />
                                        </dd>
                                    </dl>
                                    <dl class="cf">
                                        <dt>邮箱：</dt>
                                        <dd>
                                            <input type="text" class="txt" name="email" id="email" />
                                        </dd>
                                    </dl>
                                    <div class="btn">
                                        <input type="submit" name="submit" value="发送" title="发送" class="submit" />
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="homeProduct">
                            <div class="productBox">
                                <ul id="recommend_b" style="left:0;">
                                    {=foreach from=$data.recommend key=key item=item=}
                                    <li><a href="{=$item.link=}" target="_blank"><img src="{=$root=}/uploads/{=$item.img=}" alt="{=$item.title=}" /></a></li>
                                    {=/foreach=}
                                </ul>
                                <ul id="recommend_s" style="display:none;">
                                    {=foreach from=$data.recommend key=key item=item=}
                                    <li></li>
                                    {=/foreach=}
                                </ul>
                            </div>
                            <i class="l_arrow" id="recommend_left"></i>
                            <i class="r_arrow" id="recommend_right"></i>
                        </div>
                        <div class="homeNews">
                            <div class="homeInfo">
                                <div class="hd">
                                    <h3>新闻资讯</h3>
                                </div>
                                <div class="bd">
                                    <ul>
                                        {=foreach from=$news item=item=}
                                        <li>
                                            <strong>&#183;</strong>
                                            <a href="{=$base=}/?c=news&id={=$item.id=}" title="{=$item.title=}" target="_blank">{=$item.title=}</a>
                                        </li>
                                        {=/foreach=}
                                    </ul>
                                </div>
                            </div>
                            <div class="homeService">
                                <div class="hd">
                                    <h3>客户服务热线</h3>
                                </div>
                                <div class="bd">
                                    <img src="static/images/400_700_8898.png" alt="热线" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--footer-->
                    <div class="re_980 footer">
                    {=include file="blocks/footer.html"=}
                    </div>
                </div>
            </div>
        </div>
        <div class="line"></div>
        <script type="text/javascript">
            function checkMsgform(form)
            {
                if (form.content.value == "") {
                    alert("请填写内容");
                    form.content.focus();
                    return false;
                }
                if (form.name.value == "") {
                    alert("请填写姓名");
                    form.name.focus();
                    return false;
                }
                if (form.phone.value == "") {
                    alert("请填写联系电话");
                    form.phone.focus();
                    return false;
                }
                
                $.post(
                "{=$base=}/?c=message&a=save",
                {content:$("#content").val(), name:$("#name").val(), phone:$("#phone").val(), address:$("#address").val(), email:$("#email").val()},
                function(data){
                    if (data == 'success') {
                        alert("提交成功");
                        form.reset();
                    } else {
                        alert(data);
                    }
                }
            );
                
                return false;
            }
        </script>
        <script type="text/javascript">
            /**
             *glide.layerGlide((oEventCont,oSlider,sSingleSize,sec,fSpeed,point);
             *@param auto type:bolean 是否自动滑动 当值是true的时候 为自动滑动
             *@param oEventCont type:object 包含事件点击对象的容器
             *@param oSlider type:object 滑动对象
             *@param sSingleSize type:number 滑动对象里单个元素的尺寸（width或者height）  尺寸是有point 决定
             *@param second type:number 自动滑动的延迟时间  单位/秒
             *@param fSpeed type:float   速率 取值在0.05--1之间 当取值是1时  没有滑动效果
             *@param point type:string   left or top
             */
            var glide =new function(){
                function $id(id){return document.getElementById(id);};
                this.layerGlide=function(auto,oEventCont,oSlider,sSingleSize,second,fSpeed,point){
                    var oSubLi = $id(oEventCont).getElementsByTagName('li');
                    var interval,timeout,oslideRange;
                    var time=1; 
                    var speed = fSpeed 
                    var sum = oSubLi.length;
                    var a=0;
                    var delay=second * 1000; 
                    var setValLeft=function(s){
                        return function(){
                            oslideRange = Math.abs(parseInt($id(oSlider).style[point]));	
                            $id(oSlider).style[point] =-Math.floor(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +'px';		
                            if(oslideRange==[(sSingleSize * s)]){
                                clearInterval(interval);
                                a=s;
                            }
                        }
                    };
                    var setValRight=function(s){
                        return function(){	 	
                            oslideRange = Math.abs(parseInt($id(oSlider).style[point]));							
                            $id(oSlider).style[point] =-Math.ceil(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +'px';
                            if(oslideRange==[(sSingleSize * s)]){
                                clearInterval(interval);
                                a=s;
                            }
                        }
                    }
		
                    function autoGlide(){
                        for(var c=0;c<sum;c++){oSubLi[c].className='';};
                        clearTimeout(interval);
                        if(a==(parseInt(sum)-1)){
                            for(var c=0;c<sum;c++){oSubLi[c].className='';};
                            a=0;
                            oSubLi[a].className="active";
                            interval = setInterval(setValLeft(a),time);
                            timeout = setTimeout(autoGlide,delay);
                        }else{
                            a++;
                            oSubLi[a].className="active";
                            interval = setInterval(setValRight(a),time);	
                            timeout = setTimeout(autoGlide,delay);
                        }
                    }
                    
                    function cc(x) {
                        clearTimeout(timeout);
                        clearInterval(interval);
                        if(Math.abs(parseInt($id(oSlider).style[point]))>[(sSingleSize * a)]){
                            interval = setInterval(setValLeft(a),time);
                        }else if(Math.abs(parseInt($id(oSlider).style[point]))<[(sSingleSize * a)]){
                            interval = setInterval(setValRight(a),time);
                        }
                    }
	
                    if(auto){timeout = setTimeout(autoGlide,delay);};
                    for(var i=0;i<sum;i++){
                        oSubLi[i].onmouseover = (function(i){
                            return function(){
                                for(var c=0;c<sum;c++){oSubLi[c].className='';};
                                clearTimeout(timeout);
                                clearInterval(interval);
                                oSubLi[i].className="active";
                                if(Math.abs(parseInt($id(oSlider).style[point]))>[(sSingleSize * i)]){
                                    interval = setInterval(setValLeft(i),time);
                                    this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};};
                                }else if(Math.abs(parseInt($id(oSlider).style[point]))<[(sSingleSize * i)]){
                                    interval = setInterval(setValRight(i),time);
                                    this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};};
                                }
                            }
                        })(i)
                    }
                    if (oEventCont == "recommend_s") {
                        $id("recommend_right").onclick = function(){
                            if (a < (parseInt(sum) - 1)) {
                                a++;
                                cc(a);
                            }
                        };
                        $id("recommend_left").onclick = function(){
                            if (a > 0) {
                                a--;
                                cc(a);
                            }
                        }
                    }
                }
            }
            glide.layerGlide(true,'simg','bimg',960,4,0.2,'left');
            glide.layerGlide(false,'recommend_s','recommend_b',305,5,0.2,'left');
        </script>
    </body>
</html>
